package com.cly.config;

import com.cly.constant.QueueConstant;
import org.springframework.amqp.core.Binding;
import org.springframework.amqp.core.BindingBuilder;
import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.Queue;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class PhoneMQConfig {

    @Bean
    public Queue phoneQueue() {
        return new Queue(QueueConstant.PHONE_SMS_QUEUE);
    }

    @Bean
    public DirectExchange phoneEx() {
        return new DirectExchange(QueueConstant.PHONE_SMS_EX);
    }

    @Bean
    public Binding phoneBind() {
        return BindingBuilder.bind(phoneQueue()).to(phoneEx()).with(QueueConstant.PHONE_SMS_KEY);
    }


    @Bean
    public Queue wxQueue() {
        return new Queue(QueueConstant.WX_SMS_QUEUE);
    }

    @Bean
    public DirectExchange wxEx() {
        return new DirectExchange(QueueConstant.WX_SMS_EX);
    }

    @Bean
    public Binding wxBind() {
        return BindingBuilder.bind(wxQueue()).to(wxEx()).with(QueueConstant.WX_SMS_KEY);
    }


}